perm filename PROP[S1,ALS] blob
sn#397869 filedate 1978-11-24 generic text, type C, neo UTF8
COMMENT ā VALID 00002 PAGES
C REC PAGE DESCRIPTION
C00001 00001
C00002 00002 There are three ways that one might handle expressions in CONSTs.
C00004 ENDMK
Cā;
There are three ways that one might handle expressions in CONSTs.
1) PCP could evaluate all constant expressions and replace the expression
by the resulting constant.
2) PCP couls generate the necessary code to evaluate the constant and
pass this code to SOPA
2A) SOPA, in turn, could pass the code on to the compiled program which
would then evaluate the constant at the beginning of its run
2B) SOPA could evaluate the expression and only pass the resulting constant
value to the generated code
The first method would require that all of the necessary code would have to
be in PCP, but it would allow PCP to detect incorectly formulated
expressions, i.e. those that did not evaluate to a constant. There
would, of course be no side benefits for other languages that also
use SOPA.
Method 2A would have a serious defect in that there would be no checking
for incorrectly formulated expressions.
Method 2B would probably not make use of any or at least of very little
of the expression handling code in SOPA since this code is designed
to generate code for evaluating expressions, not to evaluate the
expressions directly.